1. Field of the Invention
The present invention relates to an apparatus and method for correcting a bar width, a bar code reader, and a method for decoding a bar code.
2. Description of the Related Art
In recent years, as represented by POS systems in distributors, the management of goods or the like is generally performed by bar codes. For example, in a POS system of shops, information such as the type and a price of goods is coded into the format of a bar code, and the bar code is printed on the goods. Thereafter, checkout is performed by reading the bar code on a cash disk, and the number of sold goods are counted on real time. The number of sold goods is used in stock management and buying management.
In order to correctly read a read bar code, the bar width of each of bars constituting the bar code must be correctly recognized. For this reason, some methods for correcting the bar widths of the read bar code are proposed. As one of the problems in the bar width correction, a problem that the bars of the bar code are thickened or thinned by the degradation of print quality of the bar code is known.
A conventional bar width correcting method is effective when the bar widths of a bar code are uniformly thickened or thinned. However, when the bar widths of a bar code are locally thickened or thinned by bending or the like when the bar code is pasted on a curved surface, the bar widths are not effectively corrected, and the bar code may be erroneously read. An example in which bar width correction is not effectively performed will be described below.
As one of bar codes having low print quality, a bar code in which the width of a black bar of the bar code is thickened or thinned. A method in which the influence of uniform thickening or thinning of a black bar caused by printing a bar code is removed by using a delta distance to prevent the bar code from being erroneously read is known.
More specifically, as shown in FIG. 11, with reference to a bar code (see FIG. 11(A)) having normal black bars, when a bar code (see FIG. 11 (B)) having a thick black bar or a bar code (see FIG. 11 (C)) having a thin black bar exists, a black bar portion and a white bar portion of the bar code are read as continuous values so as to detect delta distances T1 and T2. More specifically, the widths of d bar and c bar of each bar code shown in FIG. 11 are detected as the delta distances T1, and the widths of c bar and b bar are detected are detected as the delta distances T2. Thereafter, the number of modules in the delta distances T1 and T2 are detected.
As shown in FIG. 12, a first decoding table 61 in which character values are stored in correspondence with the number of modules of the delta distances T1 and T2 is prepared, and the character values corresponding to the delta distances T1 and T2 are detected from the first decoding table 61, so that the character of the bar code is decided.
When the character is decided by the number of modules of the delta distances T1 and T2, as is apparent from FIG. 12, an odd number "1" (01) and an odd number "7" (07) satisfy T1=3 and T2=4. For this reason, 01 cannot be discriminated from 07. Similarly, since an even number "2" (E2) and an even number "8" (E8) satisfy T1=3 and T2=3, E2 and E8 cannot be discriminated from each other.
For this reason, the values of characters are 01 and 07 or E2 and E8, the number of modules of black bars existing in the delta distance T1 is calculated to discriminate the characters from each other. More specifically, the number of modules of the d bar shown in FIG. 11 is calculated. A second decoding table 62 shown in FIG. 13 is prepared, the character value corresponding to the number of modules of the d bar is detected from the second decoding table 62. In this manner, a character is specified.
For example, when a delta distance satisfies T1=3 and T2=4, and the number of modules of d bar is 1, a character value is "01". When the number of modules of the d bar is 2, a character value is "07". Similarly, when a delta distance satisfies T1=3 and T2=3, and when the number of modules of d bar is 2, a character value is "E2". When the number of modules of the d bar is 1, the character value is "E8".
As described above, the width of a black bar is thickened or thinned depending on a print state. For this reason, when the number of modules of the black bar is directly calculated, the number of modules may be erroneously calculated. For this reason, in a conventional technique, bar width data of black bars (to be referred to as "X bars") of a character (or any one of guard bars and center bars) immediately before decoding is completed is used on the assumption that the black bars of the bar code are uniformly thickened or thinned, so that the width of d bar is corrected (to be referred to as a "correction decoding process": see Japanese Patent Application Laid-Open (JP-A) No. 6-36065).
More specifically, for example, when correction decoding of a character shown in FIG. 14 is performed in a forward direction (direction from a start guard bar to an end guard bar), the widths (bar width count values) of black bars (b bar and d bar) of a character to be decoded are set to be b1 and b3, respectively, and the bar width data (bar width count value) of an X bar is set to be bv. When the initial values of the bar widths are represented by Bv, B1, and B3, respectively, and when the differences between the ideal values and actual bar widths are represented by .DELTA.v, .DELTA.1, and .DELTA.3, respectively, EQU Bv=bv+.DELTA.v Equation (1) EQU B1=b1+.DELTA.1 Equation (2) EQU B3=b3+.DELTA.3 Equation (3) EQU .DELTA.x.apprxeq..DELTA.1.apprxeq..DELTA.3 Equation (4)
(assumption) are satisfied. Here, the difference between Bv and B1 and the difference between Bv and B3 are calculated, on the basis of Equation (1) and Equation (2), ##EQU1##
is satisfied. Similarly, on the basis of Equation (1) and Equation (3), EQU Bv-B3.apprxeq.bv-b3 Equation (6)
is satisfied. The Equation (5) and Equation (6) show that an error caused by printing or the like can be removed by calculating a difference between the bar widths of adjacent bars. In this case, when the number of modules of Equation (5) is calculated, the following is satisfied. However, the number of modules is represented as a symbol MOD (bar width count value). EQU MOD(Bv-B1)=MOD(bv-b1) Equation (5)'
Here, since Bv and B1 represent ideal bar widths, respectively, Bv and B1 can be divided as follows: EQU MOD(Bv-B1)=MOD(Bv)-MOD(B1).
Therefore, Equation (5)' is also expressed by: EQU MOD(Bv)-MOD(B1)=MOD(bv-b1) EQU .thrfore.MOD(B1)=MOD(Bv)-MOD(bv-b1) Equation (5)".
Equation (5)" represents that the ideal number of modules MOD (B1) of the d bar is calculated when MOD (bv-b1 ) is calculated and when MOD (bv-b1 ) is subtracted from the ideal number of modules MOD (Bv) of the bar X. Similarly, the following equation is satisfied:
MOD(B3)=MOD(Bv)-MOD(b-bv),
so that the ideal number of modules MOD (B3) of the b bar can be calculated. A character value corresponding to the ideal number of modules MOD (B1) of the d bar is read from the second decoding table 62, and the character value is set as a character value of a character to be decoded.
However, the correction decoding described above is performed on the assumption that the black bars of a bar code are uniformly thickened or thinned. For this reason, when the black bars of the bar code are locally thickened or thinned when the bar code is pasted on a curve surface, the number of modules of the d bar is erroneously calculated, and a character may be erroneously specified.
In this manner, in the conventional bar width correction, a bar width may not be able to be corrected when the bar width is not uniformly thickened or thinned.